<template>
	<div>
		<bread-crumb refresh @actRefresh="getDataList">
			<template slot="title">系统日志</template>
		</bread-crumb>

		<el-table :data="dataList" size="" v-loading="loading" border style="width:100%">
			<el-table-column prop="id" label="id" width="70"></el-table-column>
			<el-table-column prop="title" label="标题" width="200"></el-table-column>
			<el-table-column prop="type" label="类型" width="70"></el-table-column>
			<el-table-column prop="createTime" label="创建时间" width="170"></el-table-column>
			<el-table-column prop="remark" label="备注"></el-table-column>



		</el-table>
		<div class="hidden-xs">
			<el-pagination
				background
				:pager-count="pagerCount"
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:current-page="page"
				:page-sizes="[10, 20, 30, 40]"
				:page-size="pageSize"
				layout="total, sizes, prev, pager, next, jumper"
				:total="totalCount">
			</el-pagination>
		</div>
		<!--<div class="visible-xs">
			<el-pagination
				background
				:pager-count="pagerCount"
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:current-page="page"
				layout="pager"
				:total="totalCount">
			</el-pagination>
		</div>-->
	</div>
</template>

<script>
import {
	apiSystemLog,
} from '@/axios/api.system';
import { mixins } from '@/mixins/mixins.global';
import { mixinUtils } from '@/mixins/mixins.utils';
import breadCrumb from '@/views/components/breadCrumb';
export default {
	name: 'log',
	mixins:[mixins,mixinUtils],
	components:{breadCrumb},
	data() {
		return {
			//原始值
			pagerCount: 5,//饿了么垃圾分页的页块显示
			page      : 1,
			pageSize  : 10,
			totalCount: 0,//总记录数
			//复杂值
			dataList: [],
		}
	},
	mounted() {
	},
	created() {
		this.getDataList()
	},
	methods:{
		getDataList() {
			apiSystemLog({
				pageSize: this.pageSize,
				page    : this.page,
			}).then(( res ) => {
				this.totalCount = res.count
				if (res.data.length > 0) {
					this.dataList = res.data
				} else {
					this.dataList = []
				}
			})
		},






		handleSizeChange (val) {
			console.log('改变每页数',val)
			this.page = 1 //恢复第一页
			this.pageSize = val
			this.getDataList()
		},
		handleCurrentChange (val) {
			console.log('改变当前页',val)
			this.page = val
			this.getDataList()
		},
	}

};
</script>

<style lang="less">

</style>
